<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Dashboard">
    <meta name="keyword" content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <title>码客思</title>
    <link href="${rc.contextPath}/assets/css/bootstrap.css" rel="stylesheet">
    <link href="${rc.contextPath}/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="${rc.contextPath}/assets/css/style.css" rel="stylesheet">
    <link href="${rc.contextPath}/assets/css/style-responsive.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script src="${rc.contextPath}/assets/js/jquery.js"></script>
    <!-- 验证框架 -->
	<script type="text/javascript" src="${rc.contextPath}/bootstrap/bootstrap.min.js"></script>
	<script type="text/javascript" src="${rc.contextPath}/bootstrap/bootstrap-modal.js"></script>
	<script type="text/javascript" src="${rc.contextPath}/bootstrap/bootstrap-modalmanager.js"></script>
	<script type="text/javascript" src="${rc.contextPath}/bootstrap/bootstrap-validation.js"></script>
    <script src="${rc.contextPath}/assets/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="${rc.contextPath}/assets/js/jquery.backstretch.min.js"></script>
  	<!-- 弹出JS -->
	<script type="text/javascript" src="${rc.contextPath}/layer/layer.js"></script>
	<script type="text/javascript">
	function sublogin(){
		var name = $("#name").val();
		var tel = $("#tel").val();
		var email = $("#email").val();
		var qpassword = $("#qpassword").val();
		var password = $("#password").val();
		if(name == ""){
			layer.msg('请输入姓名');
			return false;
		}
		if(tel == ""){
			layer.msg('请输入手机号码');
			return false;
		}
		if(email == ""){
			layer.msg('请输入邮箱');
			return false;
		}
		if(password == ""){
			layer.msg('请输入密码');
			return false;
		}
		if(qpassword == ""){
			layer.msg('请输入确认密码');
			return false;
		}
		if(password != qpassword){
			layer.msg('两次密码不一致');
			return false;
		}
		var flag =$("#beanform").validationAjax();
		if(flag){
			$.ajax({
	            cache: true,
	            type: "POST",
	            url:"${rc.contextPath}/adduser",
	            data:$('#beanform').serialize(),// 你的formid
	            async: false,
	            error: function(request) {
	            	layer.msg("系统错误");
	            },
	            success: function(data) {
	            	if("success" == data){
	            		layer.confirm('注册用户成功将返回登录界面！', {
            			  btn: ['确定'] //按钮
            			}, function(){
            				location.href="${rc.contextPath}/login";
            			});
	            		
	            	}else{
	            		layer.msg(data);
	            	}
	            	
	            }
	        });
		}else{
			return false;
		}
		return false;
		
	}
	</script>
  </head>
  <body>
	  <div id="login-page">
	  	<div class="container">
		       <form id="beanform" class="form-login" action="#">
		        <h2 class="form-login-heading">注册码客思账户</h2>
		        <div class="login-wrap">
		            <input type="text" class="form-control" name="name" id="name" placeholder="姓名" autofocus/>
		            <br>
		            <input type="text" class="form-control" name="tel" id="tel" placeholder="手机号码" autofocus/>
		            <br>
		            <input type="text" class="form-control" name="email" id="email" placeholder="邮箱"/>
		            <br>
		            <input type="password" class="form-control" name="password" id="password" placeholder="密码">
		            <br>
		            <input type="password" class="form-control" name="qpassword" id="qpassword" placeholder="确认密码">
		            <br>
		            <button class="btn btn-theme btn-block" onclick="sublogin()" type="button"><i class="fa fa-lock"></i> 提交注册信息</button>
		        </div>
		         </form>
	  	</div>
	  </div>
  </body>
</html>
